#ifndef IMAGE_LOADER_H_INCLUDED
#define IMAGE_LOADER_H_INCLUDED
#include <fstream>
#include <map>
#include <GL/gl.h>
//#include <GL/glew.h>
#include <ImageMagick/Magick++.h>
#include "Prerequisites.h"
#include "Singleton.h"

class Texture{
    public:
        Texture(GLenum TextureTarget, const std::string& fname);
        bool Load(void);

        void Bind(GLenum TextureUnit);

    private:
        std::string mFName;
        GLenum mTextureTarget;
        GLuint mTextureObj;
        Magick::Image* mpImage;
        Magick::Blob mBlob;
};

class TextureManager : public Singleton < TextureManager > {
    private:
        std::map< std::string, Texture*> mTexMap;

		GLenum		mFormat;//加载图片格式
    public:
		TextureManager(void);

		~TextureManager(void);

        //导入纹理
        Texture* import(const std::string& texName);

        static TextureManager& getSingleton(void);

        static TextureManager* getSingletonPtr(void);

};


#endif
